import stoneRequest from "../index";

/**
 * 
 * 实战项目列表
 */
export function getMomentList(queryInfo: any) {
  return stoneRequest.get({
    url: '/moment/',
    params: queryInfo
  })
}

export function getMomentById(momentId: any) {
  return stoneRequest.get({
    url: `/moment/${momentId}`,
  })
}

export function searchMoment(content: string) {
  return stoneRequest.post({
    url: '/moment/search',
    data: {
      content
    }
  })
}

export function getMomentLabels(limit: number, offset: number) {
  return stoneRequest.get({
    url: '/label',
    params: {
      limit,
      offset
    }
  })
}

//评论回复
export function commentById(commentId: number, momentId: any, content: string) {
  return stoneRequest.post({
    url: `/comment/${commentId}/reply`,
    data: {
      momentId, 
      content
    }
  })
}

//删除评论
export function removeCommentById(commentId: number) {
  return stoneRequest.delete({
    url: `/comment/${commentId}`
  })
}

//评论文章的动态
export function participateComment(momentId: any, content: string) {
  return stoneRequest.post({
    url: '/comment',
    data: {
      momentId,
      content
    }
  })
}

//通过标签名字查询动态
export function searchMomentByLabel(labelName: string) {
  return stoneRequest.get({
    url: `/moment/searchLabels/${labelName}`,
  })
}